package com.huigao.access;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

public class AccessUtil {
	public static void main(String[] args) {

		Connection conn;
		Statement stmt;
		ResultSet rs;
		try{
			 Properties prop = new Properties(); 
			 prop.put("charSet", "gb2312"); 			 
			conn=DriverManager.getConnection("jdbc:odbc:database",prop);

			if(conn!=null){
				System.out.println("Access数据库连接成功！");
			}else{
				System.out.println("Access数据库连接失败！");
			}

			stmt=conn.createStatement();
			rs=stmt.executeQuery("select * from EventLog");
			while(rs.next()){
				System.out.println(rs.getString("PanelDate")+", "+rs.getString("ID2")+", "+rs.getString("ID2Data"));
			}

		}catch(Exception e){
			e.printStackTrace();
		}
	}

}

